// JavaScript Document

function showHideFilter(obj){
	var hasClass = $(obj).hasClass('on');
	$(obj).parent().siblings().children('div').hide();
	$(obj).siblings().hide();
	$(obj).addClass('on');
	$(obj).parent().siblings().children('a').addClass('on');
	if(hasClass){
		$(obj).removeClass('on');
		$(obj).siblings().show();
	}
}

function closeFilter(){
	(document.body||document.documentElement).removeChild(document.getElementById('_mask'));
	(document.body||document.documentElement).removeChild(document.getElementById('_maskArrow'));
	//$('a[f="1"]').removeClass('on');
	document.getElementById('slidebar').setAttribute('style','-webkit-transition: -webkit-transform 0.4s;-webkit-transform-origin: 0px 0px; -webkit-transform-style: preserve-3d;-webkit-transform: translate(190px, 0);');
	setTimeout(function(){
		$('#filterbar').hide();
	},400);
}

function showFilter(){
	$('#filterbar').show();
	var height = ((document.body||document.documentElement).clientHeight+20)+'px';
	if(parseInt($('#slidebar').css('height').replace('px',''))>parseInt(height.replace('px',''))-20){
		height = (parseInt($('#slidebar').css('height').replace('px',''))+50)+'px';
	}
	$('#filterbar').css('height',(parseInt(height.replace('px',''))-50)+"px");
	var width = '100%';
	var maskArrow = document.createElement("a");
	maskArrow.setAttribute('class','new-abtn-slid');
	maskArrow.setAttribute('style','z-index:20001;left:auto;right:185px;');
	maskArrow.setAttribute('id','_maskArrow');
	var mask = document.createElement("div");
	mask.setAttribute('id','_mask');
	mask.setAttribute('style','position:absolute;left:0px;top:0px;background-color:rgb(13, 13, 13);filter:alpha(opacity=60);opacity: 0.6;width:'+width+';height:'+height+';z-index:20000;');
	(document.body||document.documentElement).appendChild(mask);
	(document.body||document.documentElement).appendChild(maskArrow);
	var scrolltop = (document.body||document.documentElement).scrollTop;
	$('#filterbar').css("top",(scrolltop-28)+"px");
	document.getElementById('slidebar').setAttribute('style',' -webkit-transform-style: preserve-3d; -webkit-transition: -webkit-transform 0.4s; -webkit-transform-origin: 0px 0px; -webkit-transform: translate(0px, 0); ');
	$('#_maskArrow').click(function(){
		closeFilter();
	});
	$('#_mask').click(function(){
		closeFilter();
	});
}
